package com.lzy.elasticsearch.config;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.List;


@Data
@ToString
@EqualsAndHashCode
@ConfigurationProperties(prefix = "com.lzy.elasticsearch.client")
class ElasticsearchClientProperty {

    /**
     * 主节点属性
     */
    private List<ElasticsearchProperty> properties;
    /**
     * 连接用户名
     */
    private String username;
    /**
     * 连接密码
     */
    private String password;

    /**
     * 是否开启elasticsearch组件,默认不开启
     */
    private Boolean enabled = false;
    /**
     * elasticsearch 连接超时(秒)
     */
    private Integer connectTimeout = 90000;
    /**
     * socket 等待超时(秒)
     */
    private Integer socketTimeout = 90000;


    @Data
    @ToString
    @EqualsAndHashCode
    static class ElasticsearchProperty {

        private String hostname = "";

        private int port = 9200;

        private String scheme = "http";
    }
}
